/*
	Name:9_T1
	Copyright:Take it at will
	Author:Rodney
	Date: 
	Description:
*/
#include<stdio.h>

void change(int *a,int *b,int n);

int main()
{
	int a[10]={1,2,3,4,5,6,7,8,9,10},b[10]={10,9,8,7,6,5,4,3,2,1},i,j;
	puts("before exange");
	printf("a:");
	for(i=0;i<10;i++)
		printf("%d  ",a[i]);
	printf("\nb:");
	for(i=0;i<10;i++)
		printf("%d  ",b[i]);
	printf("\nthen\n");	
	for(i=0;i<10;i++)
	{
		change(a,b,i);
		printf("a:");
		for(j=0;j<10;j++)
			printf("%d  ",a[j]);
		printf("\nb:");
		for(j=0;j<10;j++)
			printf("%d  ",b[j]);
		printf("\n\n");
	 } 
}

void change(int *a,int *b,int n)
{
	int t;
	t = *(a+n);
	*(a+n) = *(b+n);
	*(b+n) = t;	
}
